//package com.yc.framework.utils;
//
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.mail.javamail.JavaMailSenderImpl;
//import org.springframework.mail.javamail.MimeMessageHelper;
//import org.springframework.stereotype.Component;
//
//import javax.mail.MessagingException;
//import javax.mail.internet.MimeMessage;
//import java.util.Properties;
//
//@Component
//public class MyMailSender {
//    @Value("${spring.mail.host}")
//    private   String host;
//    @Value("${spring.mail.username}")
//    private   String username;
//    @Value("${spring.mail.password}")
//    private   String password;
//
//    /**
//     * 邮件单发
//     *
//     * @param email    接收方
//     * @param emailMsg 发送邮件内容
//     */
//    public   void sendMail(String email, String title, String emailMsg) throws MessagingException {
//        JavaMailSenderImpl jmsi = new JavaMailSenderImpl();
//        jmsi.setHost(host);
//        jmsi.setUsername(username);
//        jmsi.setPassword(password);
//        MimeMessage mm = jmsi.createMimeMessage();
//        MimeMessageHelper mmh = new MimeMessageHelper(mm, "utf-8");
//        mmh.setTo(email);
//        mmh.setFrom(username);
//        mmh.setSubject(title);
//        mmh.setText(emailMsg);
//        Properties p = new Properties();
//        p.put("mail.smtp.auth", "true");
//        p.put("mail.smtp.timeout", "25000");
//        jmsi.setJavaMailProperties(p);
//        jmsi.send(mm);
//    }
//
//
//}
